package com.gewu.pm.ui.adapter.order;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.gewu.pm.R;
import com.gewu.pm.app.AppAdapter;

/**
 * 收款凭证图片适配器
 */
public final class VoucherImageAdapter extends AppAdapter<Integer> {

    public VoucherImageAdapter(Context context) {
        super(context);
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new ViewHolder();
    }

    private final class ViewHolder extends AppAdapter<?>.ViewHolder {

        private final ImageView ivVoucher;

        private ViewHolder() {
            super(R.layout.payment_receipt_voucher_image_item);
            ivVoucher = findViewById(R.id.iv_voucher);
        }

        @Override
        public void onBindView(int position) {
            Integer imageResId = getItem(position);
            ivVoucher.setImageResource(imageResId);
        }
    }
}

